<?php 
function LastRemaining_Solution($n, $m){
	for ($n=0; $n < =$m; $n++) { 
		for ($m=0; $m <=$n ; $m++) { 
			echo "$n-1";
		}
	}
}




 ?>